# makefile
project("VimKick")

# executable name
set(EXE "vimkick")

# ala build-configuration
set(CMAKE_BUILD_TYPE "Debug") # MinSizeRel

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts)
set(PROJECT_SOURCE_ROOT ${PROJECT_SOURCE_DIR})

#find_package(PCHSupport REQUIRED)
set(wxWidgets_USE_LIBS base core net)
find_package(wxWidgets REQUIRED)

file(GLOB SOURCES *.cpp *.h *.c)
set(SOURCES ${SOURCES} res\\\\vimkick.rc)

if(WIN32)
    add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
else(WIN32)
    if(CMAKE_COMPILER_IS_GNUCC)
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=80 ${WARNINGS}")
    endif(CMAKE_COMPILER_IS_GNUCC)

    if(CMAKE_COMPILER_IS_GNUCXX)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=80 ${WARNINGS}")
      set(WARNINGS "-Wall -Wformat -Winit-self -Wimplicit -Wparentheses -Wmissing-braces -Wsequence-point -Wreturn-type -Wswitch -Wunused-function -Wunused-label -Wunknown-pragmas -Wstrict-aliasing -Wundef -Wunsafe-loop-optimizations -Wpointer-arith -Wconversion -Wsign-compare -Wmissing-field-initializers -Wmissing-field-initializers -Winline -Winvalid-pch ")
    endif(CMAKE_COMPILER_IS_GNUCXX)

endif(WIN32)

# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${wxWidgets_C_FLAGS}")

include(${wxWidgets_USE_FILE})
include_directories(${wxWidgets_INCLUDE_DIRS})

# add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE)
add_executable(${EXE} WIN32 ${SOURCES})

# copy binaries into source root
install(TARGETS ${EXE}
        DESTINATION "${PROJECT_SOURCE_ROOT}")

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_ROOT})
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_ROOT})

# append -debug
set_target_properties(${EXE} PROPERTIES DEBUG_POSTFIX "-debug")

# includes
include_directories(.)
include_directories(libs)


# libraries
add_subdirectory(libs/testo)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/libs/testo)
target_link_libraries(${EXE} "testo")


add_subdirectory(libs/property-tree)
target_link_libraries(${EXE} "property-tree" ${wxWidgets_LIBRARIES})

add_subdirectory(libs/yasli)
target_link_libraries(${EXE} "yasli")

